<?php
require_once("vcl/vcl.inc.php");
require_once("lib/db_connection.php");
//Includes
use_unit("components4phpfull/jtjavascript.inc.php");
use_unit("components4phpfull/jtsitetheme.inc.php");
use_unit("platinumgrid/jtplatinumgrid.inc.php");
use_unit("forms.inc.php");
use_unit("extctrls.inc.php");
use_unit("stdctrls.inc.php");

//Class definition
class vendor_list extends Page
{
       public $JTVendorList = null;
       public $JTJavaScript1 = null;
       public $imgAdd = null;
       public $Image1 = null;
       public $JTSiteTheme1 = null;
       function JTVendorListShow($sender, $params)
       {
       $query1 = "select * from vendor_tbl where isCustomer=1 AND company_id='".$_SESSION['company_id']."'";
       $result = mysql_query($query1)or die(mysql_error());

        $arr = array();
        while($row = mysql_fetch_array($result))
          {
            $vendor_id = $row['vendor_id'];
            //$vendor = "<a href=vendor_edit.php?vend_id=".$vendor_id.">".$row['vendor_num']."</a>";
            $vendor = "<a href=vendor_edit.php?vend_id=".$vendor_id.">".$row['vendor_name']."</a>";
            $tools = "<img onclick=js_deleteVendor('".$vendor_id."'); src='image/delete.png' title='delete' style='cursor:pointer'>";


            $arr[] = array(
                        //'Vendor No.' => $vendor,
                        'Customer Name' => $vendor,
                        'Customer No.' => $row['vendor_num'],
                        'City' => $row['city'],
                        'Product' => $row['product'],
                        'Company Phone' => $row['comp_phone'],
                        'Tools' => $tools
                        );


          }

            $this->JTVendorList->setCellData($arr);


       }


       function vendor_listCreate($sender, $params)
       {
       $this->imgAdd->setLink('vendor_create.php');


       }

       function imgAddJSMouseOut($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['imgAdd'].src="image/add_new.png"
       <?php

       }

       function imgAddJSMouseOver($sender, $params)
       {

       ?>
       //Add your javascript code here
       document.images['imgAdd'].src="image/add_new_blue.png"
       <?php

       }

}

global $application;

global $vendor_list;

//Creates the form
$vendor_list=new vendor_list($application);

//Read from resource file
$vendor_list->loadResource(__FILE__);

//Shows the form
$vendor_list->show();

?>